package com.guoheng.safe.sys.controller;

import com.guoheng.safe.common.base.Result;
import com.guoheng.safe.sys.dto.IdDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlDataAddDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlDataPageDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlDataUpdateDTO;
import com.guoheng.safe.sys.service.ControlDataService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　ControlDataController
 *
 * @author Eternal
 * @date 2019-56-15 14:56
 */
@RestController
@Validated
@Api(value = "危险化学品罐区、库区监测数据")
public class ControlDataController {

    @Resource
    ControlDataService controlDataService;

    @PostMapping(value = "basic/control/add")
    public Result addStorageTankArea(@RequestBody @Valid ControlDataAddDTO controlDataAddDTO){
        return controlDataService.addControlData(controlDataAddDTO);
    }

    @PostMapping(value = "basic/control/update")
    public Result updateStorageTankArea(@RequestBody @Valid ControlDataUpdateDTO controlDataUpdateDTO){
        return controlDataService.updateControlData(controlDataUpdateDTO);
    }

    @PostMapping(value = "basic/control/delete")
    public Result deleteStorageTankArea(@RequestBody @Valid IdDTO idDTO){
        return controlDataService.deleteControlData(idDTO);
    }

    @PostMapping(value = "basic/control/query")
    public Result getStorageTankArea(@RequestBody @Valid IdDTO idDTO){
        return controlDataService.getControlData(idDTO);
    }

    @PostMapping(value = "basic/control/page")
    public Result getStorageTankAreas(@RequestBody @Valid ControlDataPageDTO pageDTO){
        return controlDataService.getControlData(pageDTO);
    }

}
